package com.gimi.cloud.jimi.task.service.impl;

import com.gimi.cloud.jimi.common.enums.common.RedisKeyEnum;
import com.gimi.cloud.jimi.commonService.InterfacePlatform.impl.InterfaceUtil;
import com.gimi.cloud.jimi.dao.redis.IRedisService;
import com.gimi.cloud.jimi.dto.params.SocialSecurityParam;
import com.gimi.cloud.jimi.task.service.SocialSecurityService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @auther loongs
 * @date 2018/1/11  11:36
 */
@Service
public class SocialSecurityServiceImpl implements SocialSecurityService {
    private static Logger log = LoggerFactory.getLogger(SocialSecurityServiceImpl.class);
    private final static String redisKey = RedisKeyEnum.JIMI_CONFIG_PRE.getKey() + "interface_platform_universal_socialSecurity";

    private InterfaceUtil interfaceUtil;
    private IRedisService iRedisService;
    @Autowired
    public SocialSecurityServiceImpl(InterfaceUtil interfaceUtil, IRedisService iRedisService) {
        this.interfaceUtil = interfaceUtil;
        this.iRedisService = iRedisService;
    }

    public void getRegionList() {
		SocialSecurityParam param = new SocialSecurityParam();
		param.setInterfcaeParamKey("getcitylist");
		param.setRedisKey(redisKey);
		param.setInterfcaeResultKey("returnGetcitylist");
		String data=interfaceUtil.call(param).toString();
        log.info("-------------------------------"+data);
        iRedisService.set(RedisKeyEnum.CITY_LIST_PRE.getKey()+"fengchao_shebao_city", data);
        log.info(iRedisService.get(RedisKeyEnum.CITY_LIST_PRE.getKey()+"fengchao_shebao_city"));
	}
}
